$(function() {
    alert("a");
    $(".form-myt-sale-sale-delivery-notify").data("formOptions", {
        var $form = $(this);
        var voucher=$form.find("input[name='voucher']").val();
        alert(voucher);
        bindEvents : function() {
            $form.ajaxJsonUrl(WEB_ROOT + "/myt/finance/payment-receipt-detail!findByPage?search['EQ_tradeReceipt.bizVoucher']="+ voucher,
                    function(data) {
                        var objects = data.content;
                        $.each( objects, function(key, row) {
                                            row['tradeReceipt.bizTradeUnit.id'] = objects[key].tradeReceipt.bizTradeUnit.id;
                                            row['tradeReceipt.bizTradeUnit.display'] = objects[key].tradeReceipt.bizTradeUnit.display;
                                            row['accountSummary.id'] = objects[key].tradeReceipt.accountSubject.id;
                                            row['accountSubject.display'] = objects[key].tradeReceipt.accountSubject.display;
                                            row['tradeReceipt.bizVoucher'] = objects[key].tradeReceipt.bizVoucher;
                                            row['tradeReceipt.voucher'] = objects[key].tradeReceipt.voucher;
                                            row['amount'] = objects[key].amount;
                                            row['costable'] = "1";
                                            row['paymentVouchers'] = objects[key].paymentVouchers;
                                            $grid2.data("gridOptions").calcRowAmount.call($grid2, row);
                                            $grid2.jqGrid('insertNewRowdata', row);
                                            $form.data("formOptions").updateTotalAccountAmount.call($form);
                                        });
                    })
        },
        
    });
});